package rpg.client.model;

import rpg.util.Strings;

public class Position {
	public static final Position VOID = (new Builder()).map("VOID").build();

	public static class Builder {
		public Builder()  {
			super();
		}
		
		private String mapID = "";
		public Builder map(String s)  {
			mapID = s;
			return this;
		}

		private float x = 0;
		public Builder x(float f)  {
			x = f;
			return this;
		}
		
		private float y = 0;
		public Builder y(float f)  {
			y = f;
			return this;
		}
		
		public Position build()  {
			return new Position(this);
		}
	}

	private final String mapID;
	private final float x;
	private final float y;
	
	public Position(Builder builder) {
		super();
		mapID = Strings.requireNonEmpty(builder.mapID, "Position.mapID");
		x = builder.x;
		y = builder.y;
	}

	public String getMapID() {
		return mapID;
	}
	
	public float getX()  {
		return x;
	}
	
	public float getY()  {
		return y;
	}
	
	@Override
	public String toString()  {
		return "Position " + getMapID() + " (" + getX() + ", " + getY() + ")";
	}
}
